#! /bin/sh

TARGET=~/coolsens/tools/mspgcc4
TARGET_DEMO=~/coolsens/tools/src
CURRENT=`pwd`

HTTP=http://perso.citi.insa-lyon.fr/afraboul/tar
GCC=msp430-gcc-4.4.4_gdb_7.1.tar.bz2
DBG=mspdebug
TRM=gtkterm
MIN=minicom
SRC=src.tar.gz
CNF=conf.sh

DOC=doc.tar.gz
SRC=src.tar.gz

get_mspgcc()
{
    mkdir -p $TARGET
    cd $TARGET
    wget -nc $HTTP/$GCC
    
    tar jxvf $GCC
 
    cd bin
    wget -nc $HTTP/$DBG
    chmod 755 $DBG

    #wget -nc $HTTP/$TRM
    #chmod 755 $TRM

    #wget -nc $HTTP/$MIN
    #chmod 755 $MIN
}

get_files()
{
    mkdir -p $TARGET_DEMO
    cd $TARGET_DEMO

	wget -nc $HTTP/$DOC
	tar zxvf $DOC
	wget -nc $HTTP/$SRC
	tar zxvf $SRC

}


if [ ! "$(ls $TARGET)" ] ; then 
    #echo "mspgcc est deja installe sur la machine"
    get_mspgcc 
    get_files
fi

cd $CURRENT 
export PATH=$TARGET/bin:$PATH
